import { ColumnGroupType, ColumnType } from "antd/es/table"

import { renderNullableValue, StyledParagraph } from "./venueProfitAndLoss"
import { calAccountStatus } from "./venueProfitLossDaily"

const businessMemberReport = (newFormat: (arg: string) => string): Record<string, ColumnGroupType<any> | ColumnType<any>> => ({
	memberReportStaticsDate: {
		key: "staticsDate",
		dataIndex: "staticsDate",
		width: 120,
		render: renderNullableValue("staticsDate"),
		title: newFormat("report.date"),
		align: "center",
		fixed: false
	},
	memberReportPlayerName: {
		key: "playerName",
		dataIndex: "playerName",
		width: 140,
		render: renderNullableValue("playerName"),
		title: newFormat("report.user_name"),
		align: "center",
		fixed: true
	},
	memberReportNickName: {
		key: "nickName",
		dataIndex: "nickName",
		width: 120,
		render: renderNullableValue("nickName"),
		title: newFormat("report.nick_name"),
		align: "center",
		fixed: false
	},
	memberReportAccountType: {
		key: "accountType",
		dataIndex: "accountType",
		width: 120,
		render: (_text: any, record: any) => (
			<StyledParagraph $isCurved={false}>
				{newFormat(`label.member.${record.accountType === 1 ? "formal" : "failed"}`)}
			</StyledParagraph>
		),
		title: newFormat("report.account_type"),
		align: "center",
		fixed: false
	},
	memberReportParentProxyName: {
		key: "parentProxyName",
		dataIndex: "parentProxyName",
		width: 120,
		render: renderNullableValue("parentProxyName"),
		title: newFormat("report.rerecon_parent_proxy_name"),
		align: "center",
		fixed: false
	},
	memberReportTopProxyName: {
		key: "topProxyName",
		dataIndex: "topProxyName",
		width: 120,
		render: renderNullableValue("topProxyName"),
		title: newFormat("report.proxy_top_proxy_name"),
		align: "center",
		fixed: false
	},
	memberReportAccountLockStatus: {
		key: "accountLockStatus",
		dataIndex: "accountLockStatus",
		width: 120,
		render: (_text: any, record: any) => (
			<StyledParagraph $isCurved={true}>{calAccountStatus(newFormat)(record)}</StyledParagraph>
		),
		title: newFormat("report.account_status"),
		align: "center",
		fixed: false
	},
	memberReportLabelName: {
		key: "labelName",
		dataIndex: "labelName",
		width: 120,
		render: renderNullableValue("labelName"),
		title: newFormat("report.label_name"),
		align: "center",
		fixed: false
	},
	memberReportWindControlName: {
		key: "windControlName",
		dataIndex: "windControlName",
		width: 120,
		render: renderNullableValue("windControlName"),
		title: newFormat("report.risk_control_level"),
		align: "center",
		fixed: false
	},
	memberReportRegisterAt: {
		key: "registerAt",
		dataIndex: "registerAt",
		width: 120,
		render: renderNullableValue("registerAt"),
		title: newFormat("report.register_dates"),
		align: "center",
		fixed: false
	},
	memberReportWalletBalance: {
		key: "walletBalance",
		dataIndex: "walletBalance",
		width: 120,
		render: renderNullableValue("walletBalance", "$"),
		title: newFormat("report.member_report_wallet_balance"),
		align: "center",
		fixed: false
	},
	memberReportFirstDepositAmount: {
		key: "firstDepositAmount",
		dataIndex: "firstDepositAmount",
		width: 120,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("firstDepositAmount", "$")(_text, record)} {renderNullableValue("firstDepositTime")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.first_deposit_amount")}</p>
				<p>{newFormat("report.first_deposit_time")}</p>
			</>
		),

		align: "center",
		fixed: false
	},
	memberReportBetCount: {
		key: "betCount",
		dataIndex: "betCount",
		width: 120,
		render: renderNullableValue("betCount"),
		title: newFormat("report.bet_count"),
		align: "center",
		fixed: false
	},
	memberReportBetAmount: {
		key: "betAmount",
		dataIndex: "betAmount",
		width: 120,
		render: renderNullableValue("betAmount", "$"),
		title: newFormat("report.bet_amount"),
		align: "center",
		fixed: false
	},
	memberReportValidBetAmount: {
		key: "validBetAmount",
		dataIndex: "validBetAmount",
		width: 120,
		render: renderNullableValue("validBetAmount", "$"),
		title: newFormat("report.valid_bet_amount"),
		align: "center",
		fixed: false
	},
	memberReportNetAmount: {
		key: "netAmount",
		dataIndex: "netAmount",
		width: 120,
		render: renderNullableValue("netAmount", "$"),
		title: newFormat("report.net_amount"),
		align: "center",
		fixed: false
	},
	memberReportMemberRebateAmountByProxy: {
		key: "memberRebateAmountByProxy",
		dataIndex: "memberRebateAmountByProxy",
		width: 120,
		render: renderNullableValue("memberRebateAmountByProxy", "$"),
		title: newFormat("report.proxy_grant_member_rebate"),
		align: "center",
		fixed: false
	},
	memberReportMemberRebateAmountByPlat: {
		key: "memberRebateAmountByPlat",
		dataIndex: "memberRebateAmountByPlat",
		width: 120,
		render: renderNullableValue("memberRebateAmountByPlat", "$"),
		title: newFormat("report.platform_grant_member_rebate"),
		align: "center",
		fixed: false
	},
	memberReportOtherAdjustAmount: {
		key: "otherAdjustAmount",
		dataIndex: "otherAdjustAmount",
		width: 120,
		render: renderNullableValue("otherAdjustAmount", "$"),
		title: newFormat("report.artificial_patch_amount"),
		align: "center",
		fixed: false
	},
	memberReportNetProfit: {
		key: "netProfit",
		dataIndex: "netProfit",
		width: 120,
		render: renderNullableValue("netProfit", "$"),
		title: newFormat("report.net_profit"),
		align: "center",
		fixed: false
	},
	memberReportProxyCashUpAmount: {
		key: "proxyCashUpAmount",
		dataIndex: "proxyCashUpAmount",
		width: 120,
		render: renderNullableValue("proxyCashUpAmount", "$"),
		title: newFormat("report.proxy_score"),
		align: "center",
		fixed: false
	},
	memberReportProxyCashUpTimes: {
		key: "proxyCashUpTimes",
		dataIndex: "proxyCashUpTimes",
		width: 120,
		render: renderNullableValue("proxyCashUpTimes"),
		title: newFormat("report.proxy_score_times"),
		align: "center",
		fixed: false
	},
	memberReportProxyCashDownAmount: {
		key: "proxyCashDownAmount",
		dataIndex: "proxyCashDownAmount",
		width: 120,
		render: renderNullableValue("proxyCashDownAmount", "$"),
		title: newFormat("report.proxy_points"),
		align: "center",
		fixed: false
	},
	memberReportProxyCashDownTimes: {
		key: "proxyCashDownTimes",
		dataIndex: "proxyCashDownTimes",
		width: 120,
		render: renderNullableValue("proxyCashDownTimes"),
		title: newFormat("report.proxy_points_times"),
		align: "center",
		fixed: false
	},
	memberReportProxyCreditUpAmount: {
		key: "proxyCreditUpAmount",
		dataIndex: "proxyCreditUpAmount",
		width: 120,
		render: renderNullableValue("proxyCreditUpAmount", "$"),
		title: newFormat("report.proxy_credit_up_points"),
		align: "center",
		fixed: false
	},
	memberReportProxyCreditUpTimes: {
		key: "proxyCreditUpTimes",
		dataIndex: "proxyCreditUpTimes",
		width: 120,
		render: renderNullableValue("proxyCreditUpTimes"),
		title: newFormat("report.proxy_credit_up_points_times"),
		align: "center",
		fixed: false
	},
	memberReportProxyCreditDownDmount: {
		key: "proxyCreditDownDmount",
		dataIndex: "proxyCreditDownDmount",
		width: 120,
		render: renderNullableValue("proxyCreditDownDmount", "$"),
		title: newFormat("report.proxy_credit_down_points"),
		align: "center",
		fixed: false
	},
	memberReportProxyCreditDownTimes: {
		key: "proxyCreditDownTimes",
		dataIndex: "proxyCreditDownTimes",
		width: 120,
		render: renderNullableValue("proxyCreditDownTimes"),
		title: newFormat("report.proxy_credit_down_points_times"),
		align: "center",
		fixed: false
	},
	memberReportProxyHelpCreditRepayAmount: {
		key: "proxyHelpCreditRepayAmount",
		dataIndex: "proxyHelpCreditRepayAmount",
		width: 120,
		render: renderNullableValue("proxyHelpCreditRepayAmount", "$"),
		title: newFormat("report.proxy_help_credit_repay_amount"),
		align: "center",
		fixed: false
	},
	memberReportProxyHelpCreditRepayTimes: {
		key: "proxyHelpCreditRepayTimes",
		dataIndex: "proxyHelpCreditRepayTimes",
		width: 120,
		render: renderNullableValue("proxyHelpCreditRepayTimes"),
		title: newFormat("report.proxy_help_credit_repay_times"),
		align: "center",
		fixed: false
	},
	memberReportDepositAmount: {
		key: "depositAmount",
		dataIndex: "depositAmount",
		width: 120,
		render: renderNullableValue("depositAmount", "$"),
		title: newFormat("report.deposit_amount"),
		align: "center",
		fixed: false
	},
	memberReportDepositTimes: {
		key: "depositTimes",
		dataIndex: "depositTimes",
		width: 120,
		render: renderNullableValue("depositTimes"),
		title: newFormat("report.deposit_times"),
		align: "center",
		fixed: false
	},
	memberReportWithdrawAmount: {
		key: "withdrawAmount",
		dataIndex: "withdrawAmount",
		width: 120,
		render: renderNullableValue("withdrawAmount", "$"),
		title: newFormat("report.withdraw_amount"),
		align: "center",
		fixed: false
	},
	memberReportDepositWithdrawDifferAmount: {
		key: "depositWithdrawDifferAmount",
		dataIndex: "depositWithdrawDifferAmount",
		width: 120,
		render: renderNullableValue("depositWithdrawDifferAmount", "$"),
		title: newFormat("report.deposit_withdraw_differ_amount"),
		align: "center",
		fixed: false
	},
	memberReportWithdrawTimes: {
		key: "withdrawTimes",
		dataIndex: "withdrawTimes",
		width: 120,
		render: renderNullableValue("withdrawTimes"),
		title: newFormat("report.withdraw_times"),
		align: "center",
		fixed: false
	},
	memberReportCash: {
		key: "cash",
		dataIndex: "cash",
		width: 120,
		render: renderNullableValue("cash", "$"),
		title: newFormat("report.member_report_cash"),
		align: "center",
		fixed: false
	},
	memberReportCreditAvailable: {
		key: "creditAvailable",
		dataIndex: "creditAvailable",
		width: 120,
		render: renderNullableValue("creditAvailable", "$"),
		title: newFormat("report.member_report_credit_available"),
		align: "center",
		fixed: false
	},
	memberReportCreditTotal: {
		key: "creditTotal",
		dataIndex: "creditTotal",
		width: 120,
		render: renderNullableValue("creditTotal", "$"),
		title: newFormat("report.member_report_credit_total"),
		align: "center",
		fixed: false
	},
	memberReportReturnLoan: {
		key: "returnLoan",
		dataIndex: "returnLoan",
		width: 120,
		render: renderNullableValue("returnLoan", "$"),
		title: newFormat("report.member_report_return_loan"),
		align: "center",
		fixed: false
	}
})

export default businessMemberReport
